Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
prosemirror-dropcursor
Advanced tools
The prosemirror-dropcursor package is a plugin for ProseMirror, a toolkit for building rich-text editors. This plugin adds a drop cursor to the editor, which is a visual indicator that shows where content will be inserted when it is dragged and dropped.
Adding a Drop Cursor
This code sample demonstrates how to add a drop cursor to a ProseMirror editor. The DropCursor plugin is instantiated and added to the editor's state plugins. When content is dragged and dropped into the editor, the drop cursor will indicate the insertion point.
const { DropCursor } = require('prosemirror-dropcursor');
const { EditorState } = require('prosemirror-state');
const { EditorView } = require('prosemirror-view');
const { schema } = require('prosemirror-schema-basic');
const { DOMParser } = require('prosemirror-model');
const dropCursor = new DropCursor();
const state = EditorState.create({
doc: DOMParser.fromSchema(schema).parse(document.querySelector('#content')),
plugins: [dropCursor]
});
const view = new EditorView(document.querySelector('#editor'), {
state
});
The prosemirror-gapcursor package provides a similar visual indicator for gaps between blocks in a ProseMirror editor. Unlike prosemirror-dropcursor, which shows where content will be inserted during a drag-and-drop operation, prosemirror-gapcursor shows a cursor in places where the regular text cursor cannot go, such as between two block elements.
The prosemirror-menu package offers a set of UI components for building menus in a ProseMirror editor. While it does not provide a drop cursor, it enhances the editor's functionality by adding menu items for various editing actions. This package complements prosemirror-dropcursor by providing additional user interface elements.
[ WEBSITE | ISSUES | FORUM | CHANGELOG ]
This is a non-core example module for ProseMirror. ProseMirror is a well-behaved rich semantic content editor based on contentEditable, with support for collaborative editing and custom document schemas.
This module implements a plugin that shows a drop cursor for ProseMirror.
The project page has more information, a number of examples and the documentation.
This code is released under an MIT license. There's a forum for general discussion and support requests, and the Github bug tracker is the place to report issues.
We aim to be an inclusive, welcoming community. To make that explicit, we have a code of conduct that applies to communication around the project.
dropCursor
(options?: interface = {}) → Plugin
Create a plugin that, when added to a ProseMirror instance,
causes a decoration to show up at the drop position when something
is dragged over the editor.
Nodes may add a disableDropCursor
property to their spec to
control the showing of a drop cursor inside them. This may be a
boolean or a function, which will be called with a view, a
position, and the DragEvent, and should return a boolean.
options
color
?: string
The color of the cursor. Defaults to black
.
width
?: number
The precise width of the cursor in pixels. Defaults to 1.
class
?: string
A CSS class name to add to the cursor element.
1.8.1 (2023-05-17)
Include CommonJS type declarations in the package to please new TypeScript resolution settings.
FAQs
Drop cursor plugin for ProseMirror
The npm package prosemirror-dropcursor receives a total of 874,377 weekly downloads. As such, prosemirror-dropcursor popularity was classified as popular.
We found that prosemirror-dropcursor demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.